package com.example.mybatisplus.service.impl;

import com.example.mybatisplus.model.domain.SingleTime;
import com.example.mybatisplus.mapper.SingleTimeMapper;
import com.example.mybatisplus.service.SingleTimeService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author lxp
 * @since 2022-05-31
 */
@Service
public class SingleTimeServiceImpl extends ServiceImpl<SingleTimeMapper, SingleTime> implements SingleTimeService {


    @Autowired
    private SingleTimeMapper singleTimeMapper;

    public List<Object> getWeekday(){
        return singleTimeMapper.getWeekday();
    }

    public List<Object> getTimeByWeekday(String day){
        return singleTimeMapper.getTimeByWeekday(day);
    }

    public Long getIdByTime(String time,String week){
        return singleTimeMapper.getIdByTime(time,week);
    }

    public boolean deleteByWeekdayAndTime(String weekday,String time){
        if(singleTimeMapper.deleteByWeekdayAndTime(weekday,time)==1){
            return true;
        }
        return false;
    }
}
